package org.example.login.controller;


import org.example.feign.feignClient.PojoServiceClient;
import org.example.feign.pojo.Employees;
import org.example.login.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/login")
public class LoginController {
    private final PojoServiceClient pojoServiceClient;
    private final LoginService loginService;
    @Autowired
    public LoginController(PojoServiceClient pojoServiceClient, LoginService loginService) {
        this.pojoServiceClient = pojoServiceClient;
        this.loginService = loginService;
    }
    @PostMapping("/check")
    public Map<String, Object> checkLogin(@RequestBody Map<String, Object> requestBody) throws IOException {
      Employees employees= pojoServiceClient.checkLogin(requestBody);
  return loginService.Chiek(employees);
    }}
